<?php

declare(strict_types=1);

namespace Modules\Member\Models;

use Catch\Base\CatchModel as Model;

/**
 * @property $id
 * @property $name
 * @property $description
 * @property $status
 * @property $creator_id
 * @property $created_at
 * @property $updated_at
 * @property $deleted_at
 */
class MembersPriceLog extends Model
{
    public $timestamps = true;
    protected $table = 'members_price_log';

    protected $fillable = ['id','user_id', 'start_user_id','money','type','status','order_sn','waybill','created_at', 'updated_at', 'deleted_at'];

    protected array $fields = ['id','user_id','start_user_id', 'money','type','status','order_sn','waybill','created_at', 'updated_at', 'deleted_at'];


    public array $searchable = [
        'waybill' => 'like',
        'order_sn' => 'like',
        'user_id' => '=',
        'type' =>'=',
        'start_user_id' =>'=',
    ];
    public function user()
    {
        return $this->belongsTo(Members::class,'user_id')->select(['id','avatar','username','mobile','user_level']);
    }
}
